-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #442: use reflectwalk
to walk through circuit structures without building a Schema
#444
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be OK.
I understand the change introduces a new way for walking the circuit struct to call some handler on the leafs (for initialising the variables). We do not otherwise change the behaviour (e.g. for compile we still walk several times to first get counts of variables and then build variables separately)? I think it is OK as walking for counting is quite fast.
There is now ParseDeprecated and LeafHandlerDeprecated. I didn't understand fully why they are still necessary, are they for marshalling/unmarshalling? Do we plan to fully deprecate or rewrite?
I do like that the visibility handling became simpler. Seems that it covers all the cases. At some point I fixed some problem when name was set but visibility not and then the parser assumed Secret visibility instead of inhereting, but it seems this is also now covered.
Yes behavior is unchanged, we may have some perf issues with very large complex circuits (with multi dimension slices and structs) at compile time, but nothing urgent to fix for now.
|
Closes #442 #433 #390.
Description
Introduces
schema.Walk
which behaves similarly toschema.Parse
except it doesn't build aSchema
, just visit the leaves.Known issues:
schema.Parse
to handlejson
witnesses (play.gnark.io), and it won't handle all circuit structures wellschema.Walk
doesn't like it if the leaf we are looking for is areflect.Ptr
. Only happens in...witness
where we want to identify zero values injson
will probably revisit when it's warranted.Benchmark
Old (parse full schema) vs new (walk):